import 'package:bloc_usage/bloc/AppBloc.dart';
import 'package:bloc_usage/bloc/BlocProvider.dart';
import 'package:bloc_usage/bloc/MainBloc.dart';
import 'package:bloc_usage/page/home_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return BlocProvider<AppBloc>(
        bloc: AppBloc(),
        child: MaterialApp(
          theme: ThemeData(
            primaryColor: Colors.blue,
            primarySwatch: Colors.blue,
            indicatorColor: Colors.white,
          ),
          home: BlocProvider(
            bloc: MainBloc(),
            child: MyHomePage(title: 'Flutter Demo Home Page'),
          ),
          localizationsDelegates: [
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate
          ],
          supportedLocales: [
            const Locale('zh', 'CH'),
            const Locale('en', 'US'),
          ],
        ));
  }
}
